Hello
I need to create a binary variable called precovid = 1/0 from 2 date variables defining the date of the covid diagnosis (covidfirst_date and that date – 365 days (date_1yrprecovid)
Each individual has a different date for his/her covid diagnosis, and therefore a different date_1yrprecovid, and I need to code precovid =1 if the period is between date_1yrprecovid and covidfirst_date and 0 otherwise (period post covid).
I have tried several ways and none worked
Last one was trying to use the inrange command
gen precovid=.
replace precovid=1 if inrange(date_1yrprecovid , covidfirst_date) but still nothing….
code
Would appreciate any suggestion
thanks a lot
best
Fernando
I need to create a binary variable called precovid = 1/0 from 2 date variables defining the date of the covid diagnosis (covidfirst_date and that date – 365 days (date_1yrprecovid)
Each individual has a different date for his/her covid diagnosis, and therefore a different date_1yrprecovid, and I need to code precovid =1 if the period is between date_1yrprecovid and covidfirst_date and 0 otherwise (period post covid).
I have tried several ways and none worked
Last one was trying to use the inrange command
gen precovid=.
replace precovid=1 if inrange(date_1yrprecovid , covidfirst_date) but still nothing….
code
Would appreciate any suggestion
thanks a lot
best
Fernando
Comment